package com.powernode.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.powernode.domain.StatBean;
import com.powernode.domain.VisitLog;
import com.powernode.dto.BaseDto;
import com.powernode.dto.StatDto;
import com.powernode.mapper.VisitLogMapper;
import com.powernode.service.VisitLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class VisitLogServiceImpl implements VisitLogService {
    @Resource
    private VisitLogMapper visitLogMapper;

    @Override
    public PageInfo<VisitLog> selectAll(BaseDto baseDto, Integer id) {
        Page<VisitLog> page = PageHelper.startPage(baseDto.getPage(), baseDto.getLimit());
        visitLogMapper.selectAll(id);
        return page.toPageInfo();
    }

    @Override
    public int insertSelective(VisitLog record) {
        return visitLogMapper.insertSelective(record);
    }

    @Override
    public List<StatBean> queryVisitLogCount(StatDto statDto) {
        return visitLogMapper.queryVisitLogCount(statDto);
    }
}
